﻿var Type;
var Url;
var Data;
var ContentType;
var DataType;
var ProcessData;
var method;
//Generic function to call WCF  Service
function CallService() {
    $.ajax({
        type: Type, //GET or POST or PUT or DELETE verb
        url: Url, // Location of the service
        //data: Data, //Data sent to server
        //contentType: ContentType, // content type sent to server
        dataType: DataType, //Expected data format from server
        //processdata: ProcessData, //True or False
        crossDomain: true,
        success: function (msg) {//On Successfull service call
            ServiceSucceeded(msg);
        },
        error: ServiceFailed// When Service call fails
    });
}


function RegisterNewKey(KeySerial,UserName,Email,ProductN){
    Type = "GET";
    //Url = "https://arthurgraus.cloudapp.net/UserData.svc/AddUser?UserName=" + UserName + "&UserEmail=" + Email + "&ProductName=" + ProductN + "&ProductKey=" + KeySerial;
    yUrl = "https://localhost:44303/UserData.svc/AddUser?UserName=" + UserName + "&UserEmail=" + Email + "&ProductName=" + ProductN + "&ProductKey=" + KeySerial;
    DataType = "jsonp";
    //ProcessData = false;
    CallService();
    
}

function GetResult(result) {
    alert(result);
}
function ServiceFailed(result) {
    alert('Service call failed: ' + result.status + ' ' + result.statusText);
    Type = null;
    Url = null;
    Data = null;
    ContentType = null;
    DataType = null;
    ProcessData = null;
}
function ServiceSucceeded(result) {
    alert('Success');
}
